package cn.cdutetc.foxwatch.config;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @author 王勇
 * @ClassName： JedisConnectionFactory
 * @ClassPath： cn.cdutetc.foxwatch.config.JedisConnectionFactory
 * @Description：
 * @date 2024/10/23 16:39
 */
public class JedisConnectionFactory {
    private static final JedisPool jedisPool;

    static {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxTotal(8);
        config.setMaxIdle(8);
        config.setMinIdle(0);
        config.setMaxWaitMillis(100);
        jedisPool = new JedisPool(config, "124.71.129.38", 6379, 1000, "123456");
    }

    public static Jedis getJedis() {
        return jedisPool.getResource();
    }
}
